package edu.csumb.itcd.teammario;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.ArrayList;


public class Weapon {

    
    protected int rateOfFire = 10;
    protected int range = 800;
    protected int damage;
    protected int lastShotTime;
    
    public Weapon(int damage, int rateOfFire)
    {
        this.damage = damage;
        this.rateOfFire = rateOfFire;
        lastShotTime = 0;
    }
    public void playerFire(Point start, Point destination)
    {
        //Rate of fire check ie: higher rateOfFire slower you shoot
        if (Game.gameCount >= lastShotTime + rateOfFire)
        {
            lastShotTime = Game.gameCount;
    //        System.out.println(start + "  " + destination);
            Bullet bullet = new Bullet(start, destination, damage, range);
            BulletList.addPlayerBullet(bullet);
            Player.incrementShotsFired();
        }
    }
    public void towerFire(Point start, Point2D destination)
    {
        //Rate of fire check ie: higher rateOfFire slower you shoot
        if (Game.gameCount >= lastShotTime + rateOfFire)
        {
            lastShotTime = Game.gameCount;
    //        System.out.println(start + "  " + destination);
            Bullet bullet = new Bullet(start, destination, damage, range);
            BulletList.addTowerBullet(bullet);
        }
    }
    public void enemyFire(Point start, Point destination)
    {
        //Rate of fire check ie: higher rateOfFire slower you shoot
        if (Game.gameCount >= lastShotTime + rateOfFire)
        {
            lastShotTime = Game.gameCount;
    //        System.out.println(start + "  " + destination);
            Bullet bullet = new Bullet(start, destination, damage, range);
            BulletList.addEnemyBullet(bullet);
        }
    }
//    public BulletList getBulletList()
//    {
//        return bullets;
//    }
    public void setWeaponDamage(int damage){
        this.damage = damage;
    }
    public int getWeaponDamage()
    {
    	return damage;
    }
    public void setRateOfFire(int rateOfFire)
    {
        this.rateOfFire = rateOfFire;
    }
    public String getWeaponName()
    {
    	return "Basic Weapon";
    }
	public int getDamage() {
		return damage;
	}
	public void setDamage(int damage) {
		this.damage = damage;
	}
	public int getRateOfFire() {
		return rateOfFire;
	}
}

